package com.itheima.reggie.common;

import com.itheima.reggie.domain.User;

//ThreadLocal 封装工具类
public class UserHolder {
	//维护ThreadLocal对象
	private static ThreadLocal<User> threadLocal = new ThreadLocal<>();
	
	//放入User
	public static void set(User user) {
		threadLocal.set(user);
	}
	
	//获取User
	public static User getUser() {
		return threadLocal.get();
	}
	//移除User
	public static void remove(){
		threadLocal.remove();
	}
}

